package cloudInformation.controller;

import cloudEntity.entity.SmartUserClassEntity;
import cloudEntity.leftJoin.ClassPersonLeftJoin;
import cloudEntity.utils.ResultUtils;
import cloudEntity.vo.PageBeanVO;
import cloudEntity.vo.news.SmartNewsVO;
import cloudEntity.vo.user.SmartUserClassVO;
import cloudInformation.mapper.SmartUserClassMapper;
import cloudInformation.service.SmartUserClassService;
import huang.cloudUserApi.AuthFeignClient;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: Smart School
 * @ClassName ClassController
 * @description: 班级控制器
 * @author: 陈智博
 * @create: 2025-04-14 14:52
 * @Version 1.0
 **/
@RestController
@RequestMapping(value = "/class")
@Tag(name = "班级控制器")
public class ClassController {

    @Autowired
    private AuthFeignClient authFeignClient;

    @Autowired
    private SmartUserClassService smartUserClassService;

//    @Operation(summary = "获取班级信息")
//    @RequestMapping(value = "/getInformation",method = RequestMethod.GET)
//    public ResultUtils getClassInformation()
//    {
//        Short sysUserClass = authFeignClient.smartUser().getSysUserClass();
//
//    }
    @Operation(summary = "分页获取班级信息")
    @Parameters({
            @Parameter(name = "t",description = "班级名字",required = false),
            @Parameter(name = "n",description = "页码",required = false),
            @Parameter(name = "s",description = "条数",required = false)
    })
    @RequestMapping(method = RequestMethod.GET,value = "/page")
    public ResultUtils GetClassPage(@RequestParam(value = "t",required = false,defaultValue = "") String className,
                                   @RequestParam(value = "n",required = false,defaultValue = "1") Integer pageNum,
                                   @RequestParam(value = "s",required = false,defaultValue = "5") Integer pageSize)
    {
        PageBeanVO<SmartUserClassVO> smartNewsDTOPageBeanVO = smartUserClassService.GetClassByPage(className, pageNum, pageSize);
        return ResultUtils.success(smartNewsDTOPageBeanVO);
    }

    @Operation(summary = "分页获取班级里面有那些人")
    @Parameters({
            @Parameter(name = "t",description = "人名字",required = false),
            @Parameter(name = "i",description = "班级id",required = true),
            @Parameter(name = "n",description = "页码",required = false),
            @Parameter(name = "s",description = "条数",required = false)
    })
    @RequestMapping(method = RequestMethod.GET,value = "/get/classPerson/page")
    public ResultUtils GetClassPersonPage(@RequestParam(value = "t",required = false,defaultValue = "") String personName,
                                          @RequestParam(value = "i",required = true) Integer classId,
                                          @RequestParam(value = "n",required = false,defaultValue = "1") Integer pageNum,
                                          @RequestParam(value = "s",required = false,defaultValue = "5") Integer pageSize)
    {
        PageBeanVO<ClassPersonLeftJoin> classPersonLeftJoinPageBeanVO = smartUserClassService.GetClassPersonByPage(personName,classId,pageNum,pageSize);
        return ResultUtils.success(classPersonLeftJoinPageBeanVO);
    }



}
